﻿#ifndef QMLPORXYCONFIG_H
#define QMLPORXYCONFIG_H

#include <QObject>
#include <QDebug>
#include <QCoreApplication>

class QmlPorxyConfig : public QObject
{
    Q_OBJECT
public:
    explicit QmlPorxyConfig(QObject *parent = nullptr);
    static QmlPorxyConfig *getInstance();

signals:
    // define signals for Application Service
    void startSignal(int port);
    void stopSignal();
    void logsPrintSignal(QString s);

    void PorxyStateChanged();

    void serverPortChanged();

    void settingsPathChanged();

public:
    Q_INVOKABLE int start();
    Q_INVOKABLE int stop();

    bool PorxyState() const;
    void setPorxyState(bool newPorxyState);

    int serverPort() const;
    void setServerPort(int newServerPort);

    QString settingsPath() const;
    void setSettingsPath(const QString &newSettingsPath);

private:
    bool         m_PorxyState;
    int          m_serverPort;
    QString      m_settingsPath;
    Q_PROPERTY(bool PorxyState READ PorxyState WRITE setPorxyState NOTIFY PorxyStateChanged FINAL)
    Q_PROPERTY(int serverPort READ serverPort WRITE setServerPort NOTIFY serverPortChanged FINAL)

    void log(QString s);
    Q_PROPERTY(QString settingsPath READ settingsPath WRITE setSettingsPath NOTIFY settingsPathChanged FINAL)
};

#endif // QMLPORXYCONFIG_H
